<template>
  <PageMain :before-back="titleBeforeBack">
    <template #header>
    </template>
    <template #body>
      <div class="main-container">
        <CellDesc title="资源基础信息" :list="list" />
        <CellTitle title="关联信息" />
        <Tables  :columns="dataColumns"></Tables>
        <!-- <Step1 :data="data" v-if="step === 1" />
        <Step2 
          :data="data" 
          :back="handlerStepChange"
          v-else 
        /> -->
      </div>
    </template>
  </PageMain>
</template>
<script lang="ts" setup>
import * as Api from '@/api/assetManagement/assetManagement';
import * as T from '@/api/assetManagement/assetManagement_type';
import { onMounted, ref } from 'vue';
import { useRouter } from 'vue-router';

import PageMain from '@/components/PageBox.vue';
import { Message } from '@arco-design/web-vue';
// import Step1 from './components/step1Box.vue'
// import Step2 from './components/step2Box.vue'
import CellDesc from '@/views/resource_ledger/components/CellDesc.vue';
import CellTitle from '@/views/resource_ledger/components/CellTitle.vue';
import Tables from '@/views/resource_ledger/components/Tables.vue';
const router = useRouter()
const step = ref(1)
const data = ref<T.TResourceItem>(T.DefaultTResourceItem())
const id = ref(router.currentRoute.value.params.id)

const list = ref([
  {
    name: '资源名称：',
    value: '测销售订单数据'
  },
  {
    name: '资源编号：',
    value: 'SOO10'
  },
  {
    name: '资源密级：',
    value: '有条件开放'
  },
  {
    name: '数据应用场景：',
    value: '销售'
  },
  {
    name: '数据更新频率：',
    value: '每日'
  },
  {
    name: '数据字段数：',
    value: '25'
  },
  {
    name: '数据浏览量：',
    value: '300'
  },
  {
    name: '数据下载量：',
    value: '50'
  },
  {
    name: '数据调用量：',
    value: '100'
  },
  {
    name: '更新时间：',
    value: '2024-04-11'
  },
  {
    name: '资源所属主体：',
    value: '上海鸿运龙兴科技有限公司'
  },
  {
    name: '数据资源来源：',
    value: '公开授权'
  },
  {
    name: '是否根资源：',
    value: '非根资源'
  },
  {
    name: '生产源：',
    value: ''
  },
])

const dataColumns = [
      {
        title: '资源名称',
        dataIndex: 'name',
        // main-container
      },
      {
        title: '类型',
        dataIndex: 'salary',
      },
      {
        title: '关联类型',
        dataIndex: 'address',
      },
      {
        title: '关联资源名称',
        dataIndex: 'email',
      }
    ]
function getData() {
  Api.GetResourceInfo(id.value as any).then(res => {
    if (res.code === 200 && res.data) {
      data.value = res.data
    } else {
      Message.error(res.errMsg)
    }
  })
}

function titleBeforeBack() {
  if (step.value === 1) {
    return true
  }
  step.value = 1
  return false
}

function handlerStepChange(num: number) {
  step.value = num
}

// 下一步
// function toStep2(data: T.TSourceItem) {
//   step.value = 2
// }

onMounted(() => {
  getData()
});
</script>

<style lang="less" scoped>
.resource-view-box{
  .title{
    span:first-child{
      font-family: Microsoft YaHei; font-size: 20px; font-weight: bold; color: #394D73;
    }
  }
  .footer{
    box-shadow: 0px 0px 6px 0px rgba(57, 77, 115, 0.1);
  }
}

.main-container{
  height: 100%;
  overflow-y: scroll;
  padding: 0 24px 20px;
}
</style>
